<%--
  Created by IntelliJ IDEA.
  Author: WaveHi
  Contact: HJBWaveHi@163.com
  Date: 16/9/2021
  Time: 下午 3:58
  Description: Demonstrate the use of JSTL.
  Version: 1.0
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.ArrayList" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%-- 引入核心类库 --%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %><%-- 引入格式化类库 --%>
<html>
<head>
    <title>JSTL</title>
</head>
<body>
<%--     c:if 标签的使用--%>
    <c:if test="${requestScope.judge eq \"Ok!\"}">
        <p>Ok!</p>
    </c:if>
    <c:if test="${requestScope.judge ne \"Ok!\"}">
        <p>No!</p>
    </c:if>

    <%-- c:choose 标签的使用 --%>
    <c:choose>
        <c:when test="${requestScope.num1 lt 15}">
            <p>num1 小于 15</p>
        </c:when>
        <c:when test="${requestScope.num1 eq 15}">
            <p>num1 等于 15</p>
        </c:when>
        <c:when test="${requestScope.num1 gt 15}">
            <p>num1 大于 15</p>
        </c:when>
        <c:otherwise>
            <p>数据不合法</p>
        </c:otherwise>
    </c:choose>

    <%-- c:forEach 标签的使用 --%>
    <c:forEach items="${requestScope.list}" var="item" varStatus="itemStatus">
        <p>${item}</p>
    </c:forEach>
    <%-- fmt:formatDate 标签的使用 --%>
    <label>当前时间:</label>
    <p><fmt:formatDate value="${requestScope.date}" pattern="yyyy年MM月dd号 hh:mm:ss"></fmt:formatDate></p>
</body>
</html>
